package com.qingge.springboot.service;

import com.qingge.springboot.controller.dto.LikedCountDTO;
import com.qingge.springboot.entity.UserLike;

import java.util.List;

public interface RedisService {

    /**
     * 查询redis中是否有该数据
     * @param likedMessageId
     * @param likedPostId
     */
    boolean GetLikeFromRedis(Integer likedMessageId, Integer likedPostId);

    /**
     * 点赞。状态为1
     * @param likedMessageId
     * @param likedPostId
     */
    void saveLiked2Redis(Integer likedMessageId, Integer likedPostId);

    /**
     * 取消点赞。将状态改变为0
     * @param likedMessageId
     * @param likedPostId
     */
    void unlikeFromRedis(Integer likedMessageId, Integer likedPostId);

    /**
     * 从Redis中删除一条点赞数据
     * @param likedMessageId
     * @param likedPostId
     */
    void deleteLikedFromRedis(Integer likedMessageId, Integer likedPostId);

    /**
     * 该评论的点赞数加1
     * @param likedMessageId
     */
    void incrementLikedCount(Integer likedMessageId);

    /**
     * 该评论的点赞数减1
     * @param likedMessageId
     */
    void decrementLikedCount(Integer likedMessageId);

    /**
     * 获取Redis中存储该评论的点赞数
     *
     * @param likedMessageId
     */
    int getLikedMessageValueById(Integer likedMessageId);

    /**
     * 获取Redis中存储的所有点赞数据
     * @return
     */
    List<UserLike> getLikedDataFromRedis();

    /**
     * 获取Redis中存储的所有点赞数量
     * @return
     */
    List<LikedCountDTO> getLikedCountFromRedis();

}
